{% extends "base.html" %} {% block title %}Информация :: {{ request.statuser.last_name }} {{ request.statuser.first_name }} {% endblock %} {% block content %} {% with request.statuser.get_profile as profile %} {% load filters %} 
<h1 class="userinfo">
   {{ request.statuser.last_name }} {{ request.statuser.first_name }}{% if profile.address %}, {{ profile.address }}{% endif %} 
</h1>
<table id="personalinfo" class="listing">
  <thead>
    <tr>
      <th>
         Сводка 
      </th>
      <th>
         Информация о тарифе 
      </th>
      <th>
         Состояние счёта 
      </th>
      <th>
         Статус аккаунта 
      </th>
      <th>
         Последнее подключение 
      </th>
    </tr>
  </thead>
  <tbody>
    <tr class="even">
      <td class="username">
        <div>
           {{ request.statuser.username }} 
        </div>
        <div>
           {{ request.statuser.email }} 
        </div>
         <div class="IP">
         {{ profile.ip }} 
      </div>
      <div class="reg_date">
         {{ request.statuser.date_joined|date:"d.m.Y" }}
      </div>
<div><a class="magic" href="/scripts/api?skey={{ profile.key }}">Magic link</a></div>
      </td>
<td class="tariff_info">
<p>Тариф: 
{% if user.is_staff %}
<a class="tariff_name" href="{% url change_tariff statuser=request.statuser.id %}">
{{ profile.tariff }}
</a>
{% else %}
<span class="tariff_name">{{ profile.tariff }}</span>
{% endif %}
</p>

{% if profile.tariff.cost %}<p>Абонплата: {{ profile.tariff.cost|color_balance }} за {{ profile.tariff.period }} дней</p>


{% if profile.abon_paid %}
<p class="positive-balance">оплачено до {{ profile.paid_until|date:"d.m.Y, H:i" }}</p>
{% else %}
<p class="negative-balance">тариф не оплачен</p>

{% endif %}

{% endif %}

{% if profile.prepaidpacket_set.all %}
        <ul class="tariff_info">
           {% for packet in profile.prepaidpacket_set.all %} 
          <li>
             предоплачено {{ packet.prepaid|human_bytes }} трафика "{{ packet.traffic_category }}" 
          </li>
           {% endfor %} 
        </ul>
         {% endif %} 
        <ul class="tariff_info">
           {% for rule in profile.tariff.tariffrule_set.all %} 
          <li>
             Стоимость "{{ rule.traffic_category }}": {{ rule.excess_price|human_cost }} 
          </li>
           {% endfor %} 
        </ul>
      </td>
      <td class="balance">
        <p>
           Баланс: {% if user.is_staff %}<a href='{% url pay statuser=request.statuser.id %}'>{{ profile.balance|color_balance }}</a>{% else %} {{ profile.balance|color_balance }} {% endif %} 
        </p>
        <p>
           Кредит: {{ profile.credit|color_balance }} 
        </p>
      </td>
      <td class="inet_status">
         {% if profile.blocked %}<span class="negative-balance">Заблокирован</span>{% else %} {% if profile.inet %} 
        <p class="active">
           Включён до 
        </p>
        <p class="active">
           {{ profile.inet_until|date:"d.m.Y, H:i" }} 
        </p>
        <form action="{% url inet_off statuser=request.statuser.id %}" method="POST" id="inet_off" class="turn_inet">
          <input type="submit" value="Выключить"/>
        </form>
         {% else %}<span class="inactive">Выключен</span>
        <form action="{% url inet_on statuser=request.statuser.id %}" method="POST" id="inet_on" class="turn_inet">
          <input type="submit" value="Включить"/>
        </form>
         {% endif %} {% endif %}
<p>Подключён к 
<a class="channel_name" href="{% url change_channel statuser=request.statuser.id %}">
{{ profile.channel }}
</a>(<a href="/help/#reserve">?</a>)</p>

      </td>
      <td class="last_activity">
         {{ profile.last_activity|time2str }}
      </td>
    </tr>
  </tbody>
</table>
 {% endwith %} {% endblock %} 
